<%--
  Created by IntelliJ IDEA.
  User: 乔见东方姑娘
  Date: 2023/10/7
  Time: 14:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@page isELIgnored="false" %>
<html>
<head>
    <title>data show</title>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">

    <!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
    <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap-theme.min.css" integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous">

    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
    <style>
        #search{margin: 30px}
    </style>
    <script type="text/javascript">
        function searchByCondition(){
           var sel=document.getElementById("choose")
            var index=sel.selectedIndex;
           var val=sel.options[index].value;
           alert(val)
            console.log("val"+val)
            var condition="country";
            window.location.href="/getGoodsByConditon?condition="+val;
        }
    </script>
</head>
<body>
<div id="search">
    <div class="row">
        <div class="col-md-2"></div>
        <div class="col-md-4">
            排序规则：
            <select onchange="searchByCondition()" id="choose">
                <option value="ch" >--请选择--</option>
                <option value="brand">品牌</option>
                <option value="country">国家</option>
                <option value="sellamountDesc">销量从高到底</option>
                <option value="sellamountAsc">销量从低到高</option>
                <option value="priceDesc">价格从高到低</option>
                <option value="priceAsc">价格从低到高</option>
            </select>
        </div>
        <div class="col-md-4">
            <button type="button"   class="layui-btn layui-btn-danger0000"> <a href="/shoppingcart">加入购入车</a>
            </button>
        </div>
        <div class="col-md-2"></div>
    </div>
</div>
<div class="row">
    <div class="col-md-2"></div>
    <div class="col-md-8">
        <table class="table table-striped">
            <c:choose>
                <c:when test="${not empty sessionScope.list}">
                    <caption>
                        <b>商品信息</b>
                    </caption>
                    <tr><!--第一列列表-->
                        <th>序号</th>
                        <th>标题</th>
                        <th>价格</th>
                        <th>数量</th>
                        <th>月销量</th>
                        <th>品牌</th>
                        <th>国家</th>
                    </tr>
                    <c:forEach var="good" items="${sessionScope.list}" varStatus="status">
                        <tr>
                            <td>${status.index+1}</td>
                            <td><a href="goodsDetails?gid=${good.gid}"+>${good.title}</a></td>
                            <td>${good.price}</td>
                            <td>${good.amount}</td>
                            <td>${good.sellamount}</td>
                            <td>${good.brand}</td>
                            <td>${good.country}</td>
                        </tr>

                    </c:forEach>

                </c:when>
                <c:otherwise>
                    暂时没有商品信息
                </c:otherwise>
            </c:choose>

        </table>
    </div>
    <div class="col-md-2"></div>
</div>

</body>
</html>
